#ifndef VSLIGHT_H
#define VSLIGHT_H
#include "VSAVObject.h"
#include "VSVector3.h"
#include "VSVector3W.h"
#include "VSCamera.h"
#include "VSCuller.h"
namespace VSEngine2
{
	class VSShadowMapSceneRender;
	class VSStream;
	class VSGRAPHIC_API VSLight : public VSAVObject
	{
		//RTTI
		DECLARE_RTTI;
	public:
		friend class VSSpatial;
		friend class VSScene;
		enum	//LightType
		{
			LT_POINT,
			LT_SPOT,
			LT_DIRECTION,
			LT_PROJ,
			LT_MAX
		};
		VSLight();
		virtual ~VSLight() = 0;
	public:
		virtual unsigned int GetLightType()const = 0;
		virtual bool IsRelative(VSSpatial * pSpatial);
		virtual bool Cullby(VSCuller & Culler);
	public:
		virtual unsigned int DiskUse()const;

		virtual bool Save(VSStream & rStream,unsigned int &iSaveUse)const;
		virtual bool Load(VSStream & rStream,unsigned int &iSaveUse);
	public:
		virtual bool Clone(const VSObject *pObject,unsigned int uiType);
		VSColorRGBA m_Diffuse;
		VSColorRGBA m_Specular;
		virtual void DrawShadowMap();
		void SetCastShadow(bool bIsCastShadow);
		inline bool GetCastShadow()
		{
			if (m_bEnable)
			{
				return m_bIsCastShadow;
			}
			return false;
		}
		
	protected:  
		bool m_bIsCastShadow;
		VSREAL m_fZN;
		VSREAL m_fZF;
		unsigned int m_uiRTWidth;
		unsigned int m_uiRTHeight;
					
	};
typedef VSPointer<VSLight> VSLightPtr;

}
#endif